<?php
class VentepriveeGeneratorTask extends sfBaseTask
{
  public function configure()
  {
    $this->namespace = 'generators';
    $this->name      = 'venteprivee';
    $this->addOptions(array(
            new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
            new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'doctrine'),
            new sfCommandOption('exp', null, sfCommandOption::PARAMETER_OPTIONAL, 'The new expiration date', ''),
            ));

    $this->addArgument('config', sfCommandArgument::REQUIRED, 'The config id');
  }
 
  
  public function execute($arguments = array(), $options = array())
  {
    // initialize database connection  
    $databaseManager = new sfDatabaseManager($this->configuration);
    $connection = $databaseManager->getDatabase($options['connection'])->getConnection();

    date_default_timezone_set('America/Phoenix');
    $client = new WebFormClient();

    // getting config
	$config_id = $arguments['config'];
	$generator = new VentepriveeGenerator($config_id, 'Venteprivee');
	
	$generator->execute();
	$items = $generator->getItems();
  }


  private function getAllMarques()
  {
	$jobboard = Doctrine_Core::getTable('Jobboard')->findOneByName($this->jobboard_name);
	$marques = array();
	foreach ($jobboard->Marques as $marque)
		$marques[] = $marque->name;
	return $marques;
  }
}
?>